package thread;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo48 {
    public static void main(String[] args) throws IOException {

       /*InputStream inputStream = null;
       try {
           inputStream =  new FileInputStream("./test.txt");
        } finally {
            inputStream.close();
        }*/
        //try with resources
        try (InputStream inputStream = new FileInputStream("./test.txt")){
            while (true) {
                int data = inputStream.read();
                if (data == -1) {
                    break;
                }
                System.out.printf("0x%x\n",data);
            }
        }
    }
}
